﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using ASCII.Common;
using PlayDeezGames.Common;

namespace ASCII.ClickTheYellowBox
{
    public class CTYBAboutState:CTYBStateBase
    {
        public CTYBAboutState(ASCIIRenderer theRenderer)
            : base(theRenderer)
        {           
        }


        protected override void OnStart()
        {
            Renderer.SetCells(0, 0, Renderer.GridBoard.Columns, Renderer.GridBoard.Rows, 0, ASCIICellColor.Black, ASCIICellColor.Black);
            Renderer.DrawTable(TableDrawingPalette.V2H2Palette, new int[] { 0, Renderer.GridBoard.Columns - 1 }, new int[] { 0, 2, Renderer.GridBoard.Rows - 1 }, ASCIICellColor.Blue, ASCIICellColor.DarkGray, false);
            Renderer.WriteText(1, 1, "     About \"Click the Yellow Box\"     ", ASCIICellColor.White, ASCIICellColor.DarkGray);

            Renderer.WriteText(1, 4, "Copyright 2011 PlayDeez Games", ASCIICellColor.Gray, ASCIICellColor.Black);
            Renderer.WriteText(1, 6, "Code: Ernest S. Pazera", ASCIICellColor.Gray, ASCIICellColor.Black);
            Renderer.WriteText(1, 7, "", ASCIICellColor.Gray, ASCIICellColor.Black);

            Renderer.WriteText(1, 20, "Dedicated to our Lord Jesus Christ", ASCIICellColor.Gray, ASCIICellColor.Black);

            Renderer.WriteText(1, 22, "\"For God so loved the world that he", ASCIICellColor.Cyan, ASCIICellColor.Black);
            Renderer.WriteText(1, 23, "gave his one and only Son, that who-", ASCIICellColor.Cyan, ASCIICellColor.Black);
            Renderer.WriteText(1, 24, "ever believes in him shall not perish", ASCIICellColor.Cyan, ASCIICellColor.Black);
            Renderer.WriteText(1, 25, "but have eternal life.\"", ASCIICellColor.Cyan, ASCIICellColor.Black);
            Renderer.WriteText(1, 26, "John 3:16 (NIV)", ASCIICellColor.DarkCyan, ASCIICellColor.Black);


            Renderer.WriteText(1, 28, "      Click anywhere to go back.", ASCIICellColor.Green, ASCIICellColor.Black);
        }

        protected override void OnIdle()
        {
            
        }

        protected override void OnFinish()
        {
             
        }

        private void OnDraw()
        {
            Renderer.Render();
        }

        public override bool OnMessage(MessageBase theMessage)
        {
            if (theMessage.MessageId == CTYBStateMachine.MSGID_MouseUp)
            {
                ExitState = CTYBState.Title;
                Finish();
                return true;
            }
            else if (theMessage.MessageId == CTYBStateMachine.MSGID_Draw)
            {
                OnDraw();
                return true;
            }
            else
            {
                return base.OnMessage(theMessage);
            }
        }
    }
}
